<template>
  <div class="model-form">
    <el-page-header @back="goBack" content="详情">
    </el-page-header>

    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">
        客户详情
      </el-menu-item>
      <el-menu-item index="2">
        资金明细
      </el-menu-item>
      <el-menu-item index="3">
        积分明细
      </el-menu-item>
      <el-menu-item index="4">
        用户地址
      </el-menu-item>
    </el-menu>
    <div>
      <router-view></router-view>
    </div>

  </div>
</template>

<script>
  import common from "@/mixins/common.js";

  export default {
    mixins: [common],
    data() {
      return {
        viewModel: {},
        activeIndex: "1",
      };
    },
    methods: {
      handleSelect(index) {
        var selectId = this.selectId;
        if (index == "1") {
          this.$router.replace({
            path: '/customer/view',
            query: {
              id: selectId,
              activeIndex: 1,
              time: Math.random()
            }
          })
        } else if (index == "2") {
          this.$router.replace({
            path: '/customer/stream',
            query: {
              id: selectId,
              activeIndex: 2,
              time: Math.random()
            }
          })
        } else if (index == "3") {
          this.$router.replace({
            path: '/customer/score',
            query: {
              id: selectId,
              activeIndex: 3,
              time: Math.random()
            }
          })
        } else if (index == "4") {
          this.$router.replace({
            path: '/customer/address',
            query: {
              id: selectId,
              activeIndex: 3,
              time: Math.random()
            }
          })
        } else {
          console.log(index)
        }
      }
    },
    mounted() {
      var id = this.$route.query.id;
      var activeIndex = this.$route.query.activeIndex;
      this.selectId = id;
      if (activeIndex) {
        this.activeIndex = activeIndex;
      }
    },
  };
</script>

<style>
</style>